import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'

// https://vitejs.dev/config/
export default defineConfig({
  base: '/message-plus-core',
  plugins: [vue()],
  resolve: {
    alias: {
    '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  publicDir: "public",
  server: {
    proxy: {
      '/api': {
        target: 'https://www.red-coral.cn/api',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      },
      '/md': {
        target: 'https://www.red-coral.cn/md',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/md/, '')
      }
    }
  }
})
